<?php

use Illuminate\Support\Facades\Route;
use App\Http\Middleware\Cors;
use App\Http\Controllers\SampleController;
use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\SessionController;
use App\Http\Controllers\FileControllers\FileUploadController;
use App\Http\Controllers\FileControllers\FileQueriesControllers;
use App\Http\Controllers\FileControllers\FolderNewControllers;
use App\Http\Controllers\FileControllers\FolderFileDownloadControllers;
use App\Http\Controllers\FileControllers\FolderFileDeleteControllers;
use App\Http\Controllers\FileControllers\FolderFileRenameControllers;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/sample-data', [SampleController::class, 'getData'])->name('sample')->middleware(Cors::class);

Route::post('/postData', [SampleController::class, 'postData'])->name('postData')->middleware(Cors::class);
// 注册
Route::post('/register',[RegisterController::class,'register'])->name('register')->middleware(Cors::class);
// 登录
Route::post('/login',[LoginController::class,'login'])->name('login')->middleware(Cors::class);
// session有效性验证接口
Route::get('/session',[SessionController::class,'validateSession'])->name('session')->middleware(Cors::class);
// 退出登录
Route::get('/logout',[LoginController::class,'logout'])->name('logout')->middleware(Cors::class);
// 上传文件
Route::post('/upload',[FileUploadController::class,'upload'])->name('upload')->middleware(Cors::class);
// 文件查询
Route::get('/files/{user_id}', [FileQueriesControllers::class,'file_folder'])->name('files.queries')->middleware(Cors::class);
// 新建文件夹
Route::post('/createFolders', [FolderNewControllers::class,'createFolders'])->name('createFolders')->middleware(Cors::class);


// 下载单个文件
Route::get('/download/file', [FolderFileDownloadControllers::class,'downloadFile'])->name('file.download')->middleware(Cors::class);
// 批量下载
Route::post('/download/bulk-download', [FolderFileDownloadControllers::class,'bulkDownload'])->name('file.download.bulk')->middleware(Cors::class);

// 删除文件
Route::post('/delete/deleteFileOrFolder', [FolderFileDeleteControllers::class,'deleteFileOrFolder'])->name('file.deleteFileOrFolder')->middleware(Cors::class);

// 批量删除
Route::post('/delete/bulkDelete', [FolderFileDeleteControllers::class,'bulkDelete'])->name('file.bulkDelete')->middleware(Cors::class);

// 重命名
Route::post('/rename/renameFileOrFolder', [FolderFileRenameControllers::class,'rename'])->name('file.renameFileOrFolder')->middleware(Cors::class);
